package top.aiprogram.user.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.aiprogram.user.dao.StudentMapper;
import top.aiprogram.user.entity.Student;
import top.aiprogram.user.entity.Teacher;


/**
 * Created by Evans on 2017/6/20.
 */
@Service("studentServiceImpl")
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    @Autowired
    private TeacherService teacherService;

    @Override
    @Transactional
    public int createStudent(Student student) {
        studentMapper.insertSelective(student);
        Teacher teacher = new Teacher();
        teacher.setTid(4);
        teacher.setTname("laowang");
        teacher.setTno("123456");
        teacher.setUid(30);
        teacherService.createTeacher(teacher);
        return 0;
    }
}
